#ifndef __ERROR_H__
#define __ERROR_H__
#pragma once

struct STErrorInfo;

struct STErrorLogRequest
{
	std::string appname;
	std::string page;
	std::string page_size;
	std::string sort_mode;
};

struct STErrorItemInfo
{
	std::string cmd;
	std::string fields;
	std::string error_message;
	uint32_t error_code; 
};

struct STErrorLogResponse
{
	std::vector<STErrorInfo> errorList;
	std::string status;
	std::string request_id;
	uint32_t page;
	std::string page_size;
	uint32_t count;
	std::vector<STErrorItemInfo> items;
};

class DLL_OPENSEARCH_API CErrorLog
{
public:
	static CErrorLog* getInstance();

	bool Initialize(std::string host);
	bool Destory();

	STErrorLogResponse* errorLog(STErrorLogRequest *pRequest, std::string method = "GET");
	bool parseerrorLogResponse();

	STErrorLogResponse m_errorLogResponse;
	std::string m_strUrl;
	std::map<std::string, std::string> m_mapRequestParameter;
	std::vector<std::string> m_vecRequestParameter;
private:
	CErrorLog();
	~CErrorLog();
};


#endif